﻿using Microsoft.Extensions.DependencyInjection;

namespace dotnetcore_Demo
{
    public static class StaticHttpContextExtensions
    {
        public static void AddHttpContextAccessor(this Microsoft.Extensions.DependencyInjection.IServiceCollection services)
        {
            services.AddSingleton<Microsoft.AspNetCore.Http.IHttpContextAccessor, Microsoft.AspNetCore.Http.HttpContextAccessor>();
        }

        public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseStaticHttpContext(this Microsoft.AspNetCore.Builder.IApplicationBuilder app)
        {
            var httpContextAccessor = app.ApplicationServices.GetRequiredService<Microsoft.AspNetCore.Http.IHttpContextAccessor>();
            WxOpenPlatLibCore.Utils.AppHttpContext.Configure(httpContextAccessor);
            return app;
        }
    }
}
